﻿@{
    var KeyId =Tools.HttpHelper.Request.Query["ID"];
}
<div class="page-content animated fadeInDown" style="padding-bottom:100px;">
    <div class="container-fluid">
        <div class="row" id="form">
            <!--检索面板-->

            <div class="col-sm-6 col-md-4">
                <h4 class="example-title">编号</h4>
                <input type="text" class="form-control" name="Role_Num" data-bind="value:Role_Num" placeholder="请输入 编号" />
            </div>

            <div class="col-sm-6 col-md-4">
                <h4 class="example-title">角色名</h4>
                <input type="text" class="form-control" name="Role_Name" data-bind="value:Role_Name" placeholder="请输入 角色名" />
            </div>

            <div class="col-sm-6 col-md-4">
                <h4 class="example-title">备注</h4>
                <textarea class="form-control" name="Role_Remark" data-bind="value:Role_Remark" placeholder="请输入 备注"></textarea>
            </div>


        </div>

    </div>
</div>
<!--按钮-->
<div class="my-ButtonBar text-right">
    <div class="btn-group">
        <button type="button" class="btn btn-success btn-outline" data-bind="visible: !App.IsAdd()" onclick="adminForm.resetUrl(null)">新增</button>
        <button class="btn btn-primary btn-outline" onclick="App.Save()">提交</button>
        <button class="btn btn-danger btn-outline" onclick="admin.layer.close(admin.getLayerIframeIndex());">关闭</button>
    </div>
</div>
@section css{
}
@section js{
    <script src="~/Admin/lib/Ko/Knockout-3.4.2.debug.js"></script>
    <script src="~/Admin/js/admin-form.js"></script>
    <script type="text/javascript">
        var KeyId = '@KeyId';
        model = new vModel();
        $(function () {
            ko.applyBindings(model);//注册vModel
            App.Load();
        });

        var App = {
            IsAdd: function () {
                return !KeyId;
            },
            Load: function () {
                adminForm.load({
                    KeyId: KeyId,
                    url: "@Url.Action("Find")",
                    callBack: function (r) {

                    }
                });
            },
            Save: function () {
                adminForm.Save({
                    url: "@Url.Action("Save")"
                });
            },
            FindBack: {
                CallBack: function (row, tag, dom) {
                    //if (tag == "Role") {
                    //    model.Role_ID(row ? row.Role_ID : "");
                    //    model.Role_Name(row ? row.Role_Name : "");
                    //}
                }
            }
        };

        //Role_ID, Role_Num, Role_Name, Role_Remark, Role_CreateTime
        function vModel() {
            this.Role_ID = ko.observable("");
            this.Role_Num = ko.observable("");
            this.Role_Name = ko.observable("");
            this.Role_Remark = ko.observable("");
            this.Role_CreateTime = ko.observable("");
        }
    </script>
}